Skip to content

feat: OpenCode hook bridge plugin#225

Draft
nikomatsakis wants to merge 1 commit into
symposium-dev:mainfrom
nikomatsakis:opencode-plugin
Draft

feat: OpenCode hook bridge plugin#225
nikomatsakis wants to merge 1 commit into
symposium-dev:mainfrom
nikomatsakis:opencode-plugin

Conversation

@nikomatsakis
Copy link
Copy Markdown
Member

What does this PR do?

Add a TypeScript plugin that bridges OpenCode's native tool.execute.before/after hooks to Symposium's canonical hook pipeline. The plugin is embedded in the cargo-agents binary and installed to .opencode/plugins/symposium.ts during init.

Rust side:

  • opencode.rs now returns Symposium-native event handlers for all 4 hook events
  • symposium.rs gains AgentHookOutput impls for per-event output structs
  • agents/mod.rs registers/unregisters the plugin file with @generated header, upgrade detection, and user-managed file safety

Plugin behavior:

  • tool.execute.before: applies updatedInput to args, stashes deny/context
  • tool.execute.after: injects stashed warnings and additionalContext into output
  • Cannot block tool execution; denied hooks surface as agent-visible warnings
Disclosure questions

AI disclosure.

  • The AI tool authored large parts of the code

Questions for reviewers.

Add a TypeScript plugin that bridges OpenCode's native tool.execute.before/after
hooks to Symposium's canonical hook pipeline. The plugin is embedded in the
cargo-agents binary and installed to .opencode/plugins/symposium.ts during init.

Rust side:
- opencode.rs now returns Symposium-native event handlers for all 4 hook events
- symposium.rs gains AgentHookOutput impls for per-event output structs
- agents/mod.rs registers/unregisters the plugin file with @generated header,
  upgrade detection, and user-managed file safety

Plugin behavior:
- tool.execute.before: applies updatedInput to args, stashes deny/context
- tool.execute.after: injects stashed warnings and additionalContext into output
- Cannot block tool execution; denied hooks surface as agent-visible warnings

Co-authored-by: Claude <claude@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant